#pragma once

#include "ServerHeader.h"

#include <adwaita.h>

G_BEGIN_DECLS

#define EVENT_TYPE_LOGON_PAGE (event_logon_page_get_type())
G_DECLARE_FINAL_TYPE(EventLogonPage, event_logon_page, EVENT, LOGON_PAGE,
		     AdwBin)
typedef enum
{
	EVENT_LOGON_PAGE_TYPE_LOGON,
	EVENT_LOGON_PAGE_TYPE_REGISTER,
} EventLogonPageType;

/**
 * @brief 获取当前的界面类型
 */
extern EventLogonPageType event_logon_get_page_type(EventLogonPage *self);

/**
 * @brief 设置 EventLogonPage 界面的类型：登陆或注册
 */
extern void event_logon_page_set_page_type(EventLogonPage    *self,
					   EventLogonPageType page_type);

/**
 * @brief 页面下方显示一条 Error-Info，error_info 应传入已用 gettext
 * 处理的字符串
 */
extern void event_logon_page_show_error_info(EventLogonPage *self,
					     const char	    *error_info);

/**
 * @brief 设置登陆页面的指定内容
 */
extern void event_logon_page_set_default_content(EventLogonPage *self,
						 const char	*address,
						 const char	*phone_str,
						 const char	*password);

/**
 * @brief 需要验证码输入
 */
extern void event_logon_page_need_verification_code_entry(EventLogonPage *self);

extern const char *event_logon_page_get_address(EventLogonPage *self);
extern const char *event_logon_page_get_phone_str(EventLogonPage *self);
extern const char *event_logon_page_get_password(EventLogonPage *self);
extern const char *event_logon_page_get_vcode(EventLogonPage *self);
extern const char *event_logon_page_get_user_name(EventLogonPage *self);
extern bool	   event_logon_page_is_need_verification(EventLogonPage *self);

//
extern void event_logon_page_clean_up_vcode(EventLogonPage *self);

/* 设置 EventWindow 上的返回按钮 */
extern void event_logon_page_set_relate_return_button(EventLogonPage *self,
						      GtkButton *relate_button);

/* 尝试自动登陆 */
extern void event_logon_page_try_auto_logon(EventLogonPage *self);

G_END_DECLS
